<?php

/*
 * This class is used for as Model for Product table 
 */

class Model_Shape extends Model_Base {

    protected $_name = 'shape';
    protected $_primaryKey = 'shape_id';

    /**
     *  This function is used to get Questions
     * @return null|Zend_Db_Table_Row_Abstract
     */
    public function fetchShape($where = "", $limit = "", $offset = "0", $order = 'shape_id', $sort = 'ASC') {
       
        $select = $this->select()
                ->from(array('ene' => 'shape'));
        if ($where != '') {
            $select->where($where);
        }
        if ($limit != "") {
            $select->limit($limit, $offset);
        }
        $select->order($order . " " . $sort);
        $data = parent::fetchAll($select);
        $finalArray[''] = '-- Select Shape --';
        if (!empty($data)) {
            foreach ($data->toArray() as $_area_type) {
                $finalArray[$_area_type['shape_id']] = $_area_type['shape_name'];
            }
           
        }
       
        return $finalArray;
    }
    
    public function fetchAllShape($where = "", $limit = "", $offset = "0", $order = 'shape_id', $sort = 'ASC') {
        $select = $this->select()
                ->from(array('ene' => 'shape'));
        if ($where != '') {
            $select->where($where);
        }
        if ($limit != "") {
            $select->limit($limit, $offset);
        }
        $select->order($order . " " . $sort);

        $data = parent::fetchAll($select);
        if (!empty($data)) {
            
            foreach ($data->toArray() as $_area_type) {
                $finalArray[$_area_type['shape_id']] = $_area_type['shape_name'];
            }
            return $finalArray;
        } else {
            return array();
        }
    }

}
